package code;

public class Elevator {
	public static final int IDLE = 0;
	public static final int TO_SOURCE = 1;
	public static final int TO_DESTINATION = 2;
	
	private int currentFloor;
	private int elevatorState;
	private Request request;
	
	public Elevator(){
		this.request = null;
		this.elevatorState = IDLE;
		this.currentFloor = 1;
	}

	public int getCurrentFloor() {
		return currentFloor;
	}

	public void setCurrentFloor(int currentFloor) {
		this.currentFloor = currentFloor;
	}

	public int getElevatorState() {
		return elevatorState;
	}

	public void setElevatorState(int elevatorState) {
		this.elevatorState = elevatorState;
	}

	public Request getRequest() {
		return request;
	}

	public void setRequest(Request request) {
		this.request = request;
	}
	
	public String toString(){
		return "[Floor "+currentFloor+", "+getStateDesc(elevatorState)+", "+(request==null?"---":request.toString())+"]";
	}
	
	private String getStateDesc(int elevatorState){
		if(elevatorState == 0){
			return "IDLE";
		}
		if(elevatorState == 1){
			return "TO_SOURCE";
		}
		return "TO_DESTINATION";
	}
	
}
